package com.Sv;
import java.io.PrintWriter;
import java.io.Reader;
import java.nio.charset.Charset;
import java.text.SimpleDateFormat;
import java.util.*;

import org.apache.log4j.Logger;

import com.Sql.*;
import com.ibatis.common.resources.Resources;
import com.ibatis.sqlmap.client.SqlMapClient;
import com.ibatis.sqlmap.client.SqlMapClientBuilder;

import util.*;



public class bbsSv {
	private MSDao dao = null;
	private utill ut = null;
	
	private static Logger Log = Logger.getLogger(bbsSv.class);
	public static bbsSv instance = null;
	
	
	public static bbsSv getInstance(){
		if(instance == null){
			instance = new bbsSv();
		}
		return instance;
	}


	
	
	
	
	public Map<String,Object> bbsInsert(Map<String,Object> param){
		
		dao = new MSDao();
		
		Map<String,Object> result = new HashMap<String,Object>();
		List<Map<String,Object>> l = new ArrayList<Map<String,Object>>();
		
		Date today = new Date();
		SimpleDateFormat formater = new SimpleDateFormat("YY.MM.dd");
		
		

		param.put("date",formater.format(today));
		param.put("reco","0");
		param.put("nreco","0");
		
		
	
		
		
		try{
			System.out.println("111111111");
			dao.getInsert("bbs.getInsertbbs", param);
			
		
			
			
		}catch(Exception e){
			Log.error("e - error : "+e.getMessage());
		
		
		}
		return result;
		
	}
	
	public Map<String,Object> bbsList(Map<String,Object> param){
		
		dao = new MSDao();
		
		Map<String,Object> result = new HashMap<String,Object>();
		List<Map<String,Object>> l = new ArrayList<Map<String,Object>>();
		
		
		
		try{
			System.out.println("CurrentPage:"+param.get("CurrentPage"));
			
			Pasing.setCurrentPage(param);
			System.out.println("pg:"+param.get("pg"));
			System.out.println("pg:"+param.get("bg"));
			result.put("List", dao.getList("bbs.getListbbs",param));
		    Pasing.BoxList(dao.getInt("bbs.getListCount"));
		    
		    
		}catch(Exception e){
			Log.error("e - error : "+e.getMessage());
		}
		return result;
		
	}



	
	
	
	
}
